<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>3D立方体</title>
    <style>
        .box {
            width: 400px;
            height: 400px;
            /* background-color: rgb(187, 128, 128); */
            transform: rotateX(50deg) rotateY(50deg);
            /* perspective:500px;
            perspective-origin:0 0; */
        }

        .b1 {
            transform-style: preserve-3d;
            position: relative;
            margin: 50px auto;
        }

        .face {
            width: 200px;
            height: 200px;
            border: 1px solid black;
            position: absolute;
            left: 15%;
            top: 15%;
            line-height: 200px;
            text-align: center;
            font-size: 2em;
            /* backface-visibility:hidden; */
            opacity: 0.8;
            transition: transform 1s;
            /* transform: translateZ(0); */
        }

        .front {
            background-color: rgb(184, 67, 67);
        }

        .top {

            background-color: rgb(46, 158, 32);
            transition-delay: 1s;
        }

        .bottom {
            background-color: rgb(9, 143, 27);
            transition-delay: 2s;
        }

        .back {
            background-color: rgb(67, 94, 184);
            transition-delay: 3s;
        }

        .left {
            background-color: rgb(184, 67, 155);
            transition-delay: 4s;

        }

        .right {
            background-color: rgb(139, 184, 67);
            transition-delay: 5s;
        }

        #btn:active+.box .front {
            transform: translateZ(100px);

        }

        #btn:active+.box .top {
            transform:   rotateX(90deg) translateZ(100px);

        }

        #btn:active+.box .bottom {
            transform: rotateX(-90deg) translateZ(100px);

        }

        #btn:active+.box .back {
            transform: rotateY(180deg) translateZ(100px);

        }

        #btn:active+.box .left {
            transform: rotateY(90deg) translateZ(100px);

        }

        #btn:active+.box .right {
            transform: rotateY(-90deg) translateZ(100px);
        }
    </style>
</head>

<body>


    <button id="btn">按住</button>
    <div class="box b1">
        <div class="face front">
            Front
        </div>
        <div class="face top">
            top
        </div>
        <div class="face bottom">
            Bottom
        </div>
        <div class="face back">
            Back
        </div>

        <div class="face left">
            Left
        </div>
        <div class="face right">
            Right
        </div>

    </div>
</body>

</html>